package com.xingkeduo.pojo.enums;

import com.xingkeduo.util.pojo.base.BaseEnum;

/**
 * @Description:
 * @Author:gaozifeng
 * @Date 2019/5/6 21:01
 **/
public enum ServiceEnums implements BaseEnum {
    SINGLE_HAIRCUT(1, "单人剪发服务"),
    SINGLE_LIUHAI(2, "单人刘海服务"),
    SINGLE_REDUCTION(5, "10分钟修边服务"),
    SINGLE_BABEER(4, "美式Barber"),
	SINGLE_BABEER_HALF(6, "美式Barber半头修剪");

    private int type;

    private String name;

    private ServiceEnums(int type, String name) {
        this.type = type;
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public ServiceEnums setType(int type) {
        this.type = type;
        return this;
    }

    public String getName() {
        return name;
    }

    public ServiceEnums setName(String name) {
        this.name = name;
        return this;
    }

    public static boolean validValue(String value) {
        int value_int = Integer.parseInt(value);
        return validValue(value_int);
    }

    public static boolean validValue(int value) {
        ServiceEnums[] enums = ServiceEnums.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getValue() == value)
                return true;
        }
        return false;
    }

    public static ServiceEnums getStatus(String value) {
        int value_int = Integer.parseInt(value);
        return getStatus(value_int);
    }

    public static ServiceEnums getStatus(int value) {
        ServiceEnums[] statuses = ServiceEnums.values();
        for (int i = 0; i < statuses.length; i++) {
            if (statuses[i].getValue() == value)
                return statuses[i];
        }
        return null;
    }


    @Override
    public int getValue() {
        // TODO Auto-generated method stub
        return type;
    }}
